require("../../../api.js").order;

var n = require("../../../api.js"), e = getApp();

Page({
    data: {
        isShow: !1,
        keyBoardType: 1,
        car_num: ""
    },
    onLoad: function(n) {
        var e = n.order_no;
        this.data.order_no = e, console.log(e);
    },
    carInfoSubmit: function(o) {
        var t = this, a = o.detail.value, i = a.car_type, r = a.car_num, c = a.car_remark;
        if (!i || !r || !c) return wx.showToast({
            title: "请填写表单",
            icon: "none"
        }), !1;
        e.request({
            url: n.driver.setCarInfo,
            method: "post",
            data: {
                order_no: t.data.order_no,
                car_type: i,
                car_number: r,
                car_remark: c
            },
            success: function(n) {
                wx.showToast({
                    title: n.msg,
                    icon: "none"
                }), 1 == n.code && setTimeout(function() {
                    wx.navigateBack();
                }, 800);
            }
        });
    },
    selectNum: function() {
        this.keyboardHandle(!0);
    },
    inputChange: function(n) {
        this.checkValue(n.detail);
    },
    checkValue: function(n) {
        var e;
        console.log(n, this.data.car_num.slice(0, -1)), e = n ? this.data.car_num + n : this.data.car_num.slice(0, -1), 
        this.setData({
            car_num: e,
            keyBoardType: 0 == e.length ? 1 : 2
        });
    },
    inputOk: function() {
        this.closeInput();
    },
    keyboardHandle: function(n) {
        this.setData({
            isShow: n
        });
    },
    closeInput: function() {
        this.keyboardHandle(!1);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});